/**
 * @param {Egg.Application} app - egg application
 */
module.exports = (app) => {
  const { router, controller } = app

  router.prefix('/api')

  // 欢迎
  router.get('/home', controller.home.index)
  router.get('/test', controller.home.test)

  // 测试用例
  router.post('/test/testList', controller.testTest.testList)
  router.post('/test/testAdd', controller.testTest.testAdd)
  router.post('/test/testUpdate', controller.testTest.testUpdate)
  router.post('/test/testDelete', controller.testTest.testDelete)
  router.post('/test/testAddBatch', controller.testTest.testAddBatch)
  router.post('/test/testDeleteBatch', controller.testTest.testDeleteBatch)

  router.post('/test/testforeignList', controller.testTestforeign.testforeignList)
  router.post('/test/testforeignAdd', controller.testTestforeign.testforeignAdd)
  router.post('/test/testforeignUpdate', controller.testTestforeign.testforeignUpdate)
  router.post('/test/testforeignDelete', controller.testTestforeign.testforeignDelete)
  router.post('/test/testforeignAddBatch', controller.testTestforeign.testforeignAddBatch)
  router.post('/test/testforeignDeleteBatch', controller.testTestforeign.testforeignDeleteBatch)

  // 登录相关
  router.post('/user/login', controller.sysUser.login)
  router.post('/user/refreshToken', controller.sysUser.refreshToken)
  router.post('/user/register', controller.sysUser.register)
  router.get('/user/hasAdmin', controller.sysUser.hasAdmin)
  router.get('/user/getCaptcha', controller.sysUser.getCaptcha)
  router.post('/user/logout', controller.sysUser.logout)
  router.get('/user/verifyToken', controller.sysUser.verifyToken)
  router.post('/user/userList', controller.sysUser.userList)
  router.post('/user/userUpdate', controller.sysUser.userUpdate)
  router.post('/user/changeStatus', controller.sysUser.changeStatus)

  // 角色
  router.post('/user/roleList', controller.sysRole.roleList)
  router.post('/user/roleAdd', controller.sysRole.roleAdd)
  router.post('/user/roleUpdate', controller.sysRole.roleUpdate)
  router.post('/user/roleDelete', controller.sysRole.roleDelete)
  router.post('/user/roleAddBatch', controller.sysRole.roleAddBatch)
  router.post('/user/roleDeleteBatch', controller.sysRole.roleDeleteBatch)

  // 权限
  router.post('/user/permissionList', controller.sysPermission.permissionList)
  router.post('/user/permissionAdd', controller.sysPermission.permissionAdd)
  router.post('/user/permissionUpdate', controller.sysPermission.permissionUpdate)
  router.post('/user/permissionDelete', controller.sysPermission.permissionDelete)
  router.post('/user/permissionAddBatch', controller.sysPermission.permissionAddBatch)
  router.post('/user/permissionDeleteBatch', controller.sysPermission.permissionDeleteBatch)
}
